﻿@using MvcAtletIS.Helpers;
@model IEnumerable<MvcAtletIS.Models.Performances>
@{
    ViewBag.Title = "Editor prihlášok";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head {

    <link href="@Url.Content("~/footable/css/footable.core.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/footable/css/footable.standalone.css")" rel="stylesheet" type="text/css" />
  
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.sort.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.filter.js")" type="text/javascript"></script>
    
    <script type="text/javascript">
        $(function () {
            $("table").footable();

            $(".clear-filter").click(function (e) {
                e.preventDefault();
                $("table").trigger("footable_clear_filter");
            });
        });
    </script>
}

<h2>Prihlášky: @ViewBag.Competition.Name</h2>

@using (Html.BeginForm())
{   
       
    <div class="filter-frame">
        
        <div class="filter-item">
            <div class="editor-label">
                Disciplína
            </div>
            <div class="editor-field">
                @Html.DropDownList("DisciplineListId", null, "Vyberte disciplínu", new { onchange = "this.form.submit();" })
            </div>
        </div> 
    
    </div>   
}

<p>
    @Html.ActionLink("< Preteky", "Index", "Competitions") |
    @Html.ActionLink("Prihlásiť", "Create", new { CompetitionId = @ViewBag.Competition.ID }) |
    @Html.ActionLink("Prihlásiť z registrácie", "CreateReg", new { CompetitionId = @ViewBag.Competition.ID, DisciplineListId = @ViewBag.DisciplineListId.SelectedValue })
</p>

@if (Model.Count() > 0)
{
<table class="footable table toggle-arrow-tiny" data-filter="#text-filter" data-filter-minimum="3">
    <thead>
        <tr>
            <th data-class="expand">
                Priezvisko
            </th>
            <th>
                Meno
            </th>
            <th data-type="numeric">
                Dátum
            </th>
            <th>
                Klub
            </th>
            <th>
                Krajina
            </th>
            <th data-hide="phone,tablet">
                PB
            </th>
            <th data-hide="phone,tablet">
                SB
            </th>
            <th width="100px" data-sort-ignore="true"></th>
        </tr>
    </thead>
    <tbody>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Surname)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.FirstName)
            </td>
            <td align="right">
                @Html.DisplayFor(modelItem => item.Birthdate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Club)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CountryId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PB)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SB)
            </td>
            <td>
                @Html.ImageActionLink(Url.Content("~/Content/icons/preview.gif"), "", "Details", new { id = item.ID }, new { title = "Zobraziť", border = 0, hspace = 2 }) |
                @Html.ImageActionLink(Url.Content("~/Content/icons/edit.gif"), "", "Edit", new { id = item.ID }, new { title = "Editovať", border = 0, hspace = 2 }) |
                @Html.ImageActionLink(Url.Content("~/Content/icons/delete.gif"), "", "Delete", new { id = item.ID }, new { title = "Zmazať", border = 0, hspace = 2 })
            </td>
        </tr>
    }
    </tbody>
</table>

}

<p>
    Počet prihlásených pretekárov: @Model.Count()
</p>


